package cn.bone.activiti01.controller;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Resource
    private RepositoryService repositoryService;

    @RequestMapping("/demo01")
    public String demo01(){
        return "demo01";
    }


    @RequestMapping("/deploy")
    public String deploy(){

        DeploymentBuilder deployment = repositoryService.createDeployment();
        deployment.name("请假流程-001")
                .addClasspathResource("/processes/HelloWorld.bpmn");


        return "deploy";
    }
}
